X-Git-Url: https://scm.cri.minesparis.psl.eu/git/minwii.git/blobdiff_plain/40af98705c25adcf25ff58b08dc495f0f4322f88..f81a7fb356c789c2b1b1a689e3776bc997a11587:/WiiMouse%20IR%20coeff0.1.PIE?ds=inline diff --git a/WiiMouse IR coeff0.1.PIE b/WiiMouse IR coeff0.1.PIE deleted file mode 100755 index 8856f61..0000000 --- a/WiiMouse IR coeff0.1.PIE +++ /dev/null @@ -1,166 +0,0 @@ -Wiimote1.led1 = true -Wiimote2.led1 = true -Wiimote2.led4 = true -Wiimote3.led2 = true -Wiimote4.led2 = true -Wiimote4.led4 = true -Wiimote5.led3 = true -Wiimote6.led3 = true -Wiimote6.led4 = true -//Mouse Control Script using IR -//by vkapadia with much assistance from inio -//vkapadia@vkapadia.com -// -//Calibration: -//To calibrate, run this program and put the Wiimote on a flat surface face-up. -//Then read the values in the debug line (next to the run button). -//Change these values until the debug line reads approx. all zeros. -var.xtrim1 = -1 -var.ytrim1 = -25 -var.ztrim1 = 2 - -var.xtrim2 = -1 -var.ytrim2 = -25 -var.ztrim2 = 2 - -var.coeff = 0.1 - -// -//Options: -var.deadzone = 5 //distance in pixels that you have to move the wiimote in - //order for it to register movement. Creates a "dead zone" around the pointer - //to make it easier to click. Higher = smoother but less accurate. -//fake cursor init - -//cursor2.visible = true - -//more options to be added later - -//Controls: -//Point Wiimote = Move Mouse -//D-Pad = Arrow Keys -//B-Button = Left Click -//Home = Middle Click -//A-Button = Right Click -//Plus and Minus = Control Volume -//One = Unmapped -//Two = Unmapped -// -//If the pointer hits the edge of the screen, the Wiimote will rumble a bit. -// -//The LEDs attempt to emulate KITT's grill from Knight Rider - -//***Do not edit anything below this line unless you know what you are doing.*** -var.accx1 = wiimote1.RawForceX1 + var.xtrim1 -var.accy1 = wiimote1.RawForceY1 + var.ytrim1 -var.accz1 = wiimote1.RawForceZ1 + var.ztrim1 - -if wiimote1.dot1vis and wiimote1.dot2vis then - - if var.accy1 > -7 then - var.orientation1 = 0 - elseif var.accy1 > -45 then - if var.accx1 < 0 then - var.orientation1 = 3 - else - var.orientation1 = 1 - endif - else - var.orientation1 = 2 - endif - - if var.leftpoint1 = 0 then - if var.orientation1 = 0 then - if wiimote1.dot1x < wiimote1.dot2x then - var.leftpoint1 = 1 - else - var.leftpoint1 = 2 - endif - endif - if var.orientation1 = 1 then - if wiimote1.dot1y > wiimote1.dot2y then - var.leftpoint1 = 1 - else - var.leftpoint1 = 2 - endif - endif - if var.orientation1 = 2 then - if wiimote1.dot1x > wiimote1.dot2x then - var.leftpoint1 = 1 - else - var.leftpoint1 = 2 - endif - endif - if var.orientation = 3 then - if wiimote1.dot1y < wiimote1.dot2y then - var.leftpoint1 = 1 - else - var.leftpoint1 = 2 - endif - endif - endif - - if var.leftpoint1 = 1 then - var.fix1x1 = wiimote1.dot1x - var.fix1y1 = wiimote1.dot1y - var.fix2x1 = wiimote1.dot2x - var.fix2y1 = wiimote1.dot2y - else - var.fix1x1 = wiimote1.dot2x - var.fix1y1 = wiimote1.dot2y - var.fix2x1 = wiimote1.dot1x - var.fix2y1 = wiimote1.dot1y - endif - - var.dx1 = var.fix2x1 - var.fix1x1 - var.dy1 = var.fix2y1 - var.fix1y1 - var.cx1 = (var.fix1x1+var.fix2x1)/1024.0 - 1 - var.cy1 = (var.fix1y1+var.fix2y1)/1024.0 - .75 - - var.d1 = sqrt(var.dx1*var.dx1+var.dy1*var.dy1) - - var.dx1 = var.dx1 / var.d1 - var.dy1 = var.dy1 / var.d1 - - var.ox1 = -var.dy1*var.cy1-var.dx1*var.cx1; - var.oy1 = -var.dx1*var.cy1+var.dy1*var.cx1; - - var.ax1 = (var.ox1 * var.coeff*screen.desktopwidth) + (screen.desktopwidth* var.coeff / 2) - var.ay1 = (-var.oy1* var.coeff * screen.desktopwidth) + (screen.desktopheight* var.coeff / 2) - - var.dx1 = var.ax1 - cursor2.posx - var.dy1 = var.ay1 - cursor2.posy - - var.d1 = sqrt((var.dx1*var.dx1)+(var.dy1*var.dy1)) - - var.a1 = 180 / (200 + var.d1 * var.d1 * var.d1 * .001) - - if var.d1 <= var.deadzone then var.a1 = 1 - - //debug = var.d + " " + var.a - - var.finalx1 = cursor2.posx * var.a1 + var.ax1 * (1 - var.a1) - var.finaly1 = cursor2.posy * var.a1 + var.ay1 * (1 - var.a1) - - - cursor2.posx = smooth(var.finalx1,3,5) - cursor2.posy = smooth(var.finaly1,3,5) - -else - - var.leftpoint1 = 0 - -endif - -var.xpos1 = var.finalx1 -var.ypos1 = var.finaly1 -ppjoy1.analog0 = ensuremaprange(var.xpos1,0,screen.desktopwidth* var.coeff,-1,1) -ppjoy1.analog1 = ensuremaprange(var.ypos1,0,screen.desktopheight* var.coeff,-1,1) - -if wiimote1.B or wiimote1.A or wiimote1.Up or wiimote1.down or wiimote1.Left or wiimote1.Right == true - ppjoy1.digital0 = true -else - ppjoy1.digital0 = false -endif - -debug = var.accx1+ " " + var.accy1+ " " + var.accz1